{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[ 1.658985,  4.285136],\n",
       "        [-3.453687,  3.424321],\n",
       "        [ 4.838138, -1.151539],\n",
       "        [-5.379713, -3.362104],\n",
       "        [ 0.972564,  2.924086]]),\n",
       " (80, 2))"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "\n",
    "#加载数据\n",
    "def load_data(file_name):\n",
    "    with open(file_name) as fr:\n",
    "        lines = fr.readlines()\n",
    "\n",
    "    x = np.empty((len(lines), 2), dtype=float)\n",
    "\n",
    "    for i in range(len(lines)):\n",
    "        line = lines[i].split('\\t')\n",
    "        x[i] = line\n",
    "\n",
    "    return x\n",
    "\n",
    "\n",
    "x = load_data('简单数据.txt')\n",
    "x[:5], x.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#定义常量\n",
    "N, M = x.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAVRklEQVR4nO3df2xdZ33H8c+3xhtGwMwWS6hOQiJtChQyFO2uquQ/NtKyFFraqGIabEVI/BFNAqllbbpklcb4Y2qmSMAfIE3RNmlSqxVYi/lRUGiVommdinDqhi5LM3XQtHWLMCoZiFqr4373h+3Gvj7XPvfe55zzPM95v6RK9bVz7nPvOfd7v+f7fM9zzN0FAEjXFU0PAAAwHAI5ACSOQA4AiSOQA0DiCOQAkLg3NPGk27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Ztsl3SDpH5oeyyAI5BUxs5skzbn7mabH0oBPSPpO04MIbFLS82t+fkEZB7a1zGyXpH2Svt/sSCr1BS0nXa81PZBBcIegIZjZI5LeXvCruyX9laQ/qndE1drs9br711f+5m4tn5bfV+fYamAFj2V/pmVmb5b0gKTb3f0XTY+nCmZ2o6SfuvtpM/vDpsczCAL5ENz9uqLHzWyvpN2SzpiZtFxmeMLMrnb3n9Q4xKB6vd5VZvZxSTdKutbzu0DhBUk71vy8XdKLDY2lFmY2quUgfp+7P9j0eCo0JekmM/ugpDdKequZ3evutzY8rtK4IKgGZvaspI67x7yq2lDM7HpJn5P0B+4+3/R4QjOzN2h5EvdaSXOSfiDpT939bKMDq4gtZyD/LOlld7+96fHUZSUjv9Pdb2x6LP2gRo5QvijpLZIeNrMnzezvmx5QSCsTuZ+SdFLLE39fyTWIr5iS9DFJ+1f255MrGSsiREYOAIkjIweAxBHIASBxBHIASByBHAASRyAHgMQRyAEgcQRyAEjc/wN/EF4+FapSQgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from matplotlib import pyplot as plt\n",
    "\n",
    "\n",
    "#画图\n",
    "def draw(cent=None, pred=None):\n",
    "    plt.scatter(x[:, 0], x[:, 1], c=pred)\n",
    "\n",
    "    if cent is not None:\n",
    "        plt.scatter(cents[:, 0], cents[:, 1], c='red', s=100)\n",
    "\n",
    "    plt.show()\n",
    "\n",
    "\n",
    "draw()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5.9734869999999995"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def distance(x1, x2):\n",
    "    return np.sum(np.abs(x1 - x2))\n",
    "\n",
    "\n",
    "distance(x[0], x[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.79983619  1.88628731]\n",
      " [-4.24430882 -1.97829499]\n",
      " [ 1.7312281  -0.28369848]\n",
      " [ 2.0442153  -2.28675645]]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAYZ0lEQVR4nO3db4xc5XXH8d+xWZKlxt20rFSxQIysipQUIksTFMkv2jgJ4EDAQls1aW1FyotV5UYC13FqFylpKkU4sohTyZEi6r5AGDV/DHH+IMshMnlRIqKsWWxCwRWbvyyN4igxgXhb1svpi/Hi3dmZnTszz733ee79fiS07N3x3Gd37pw59zznPtfcXQCAdK0qewAAgMEQyAEgcQRyAEgcgRwAEkcgB4DEXVLGTq+44gpft25dGbsGgGSdOHHi1+4+2rq9lEC+bt06TU5OlrFrAEiWmf2s3XZKKwCQOAI5ACSOQA4AiSOQA0DiCOQAkLhSulYAxOfI1Iz2HTutl8/O6sqRYe265Tpt2TBW9rCQAYEcgI5MzWjPo89qdm5ekjRzdlZ7Hn1WkioTzKv8QUVpBYD2HTv9ZhBfMDs3r33HTpc0orAWPqhmzs7KdfGD6sjUTNlDC4JADkAvn53taXtqqv5BRSAHoCtHhnvanpqqf1ARyAFo1y3XaXho9ZJtw0OrteuW60oaUVhV/6AikAPQlg1juu+uGzQ2MiyTNDYyrPvuuqEyk4FV/6CiawWApGYwr0rgbrXwe1W1a4VADqAWqvxBRWkFABJHIAeAxBHIASBxBHIASByBHAASRyAHgMQRyAEgcQRyAEgcgRwAEkcgB4DEcYk+UCNVvktOnRHIkRuCRlzqcDu3uqK0glxU/dZaKar6XXLqjEC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kAOAIkjkANA4gjkAJA4AjkAJI5ADgCJ+3+rqIIIS5EvKwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#随机初始化k个中心点\n",
    "def rand_cent(k):\n",
    "\n",
    "    cent = np.empty((k, M))\n",
    "    for col in range(M):\n",
    "        cent[:, col] = np.random.uniform(low=x[:, col].min(),\n",
    "                                         high=x[:, col].max(),\n",
    "                                         size=(k))\n",
    "    return cent\n",
    "\n",
    "\n",
    "cents = rand_cent(4)\n",
    "print(cents)\n",
    "\n",
    "draw(cents)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3, 2.992805354830718)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def predict(xi, cents):\n",
    "    min_ki = 0\n",
    "    min_d = np.inf\n",
    "    for ki in range(len(cents)):\n",
    "        d = distance(xi, cents[ki])\n",
    "        if d < min_d:\n",
    "            min_d = d\n",
    "            min_ki = ki\n",
    "    return min_ki, min_d\n",
    "\n",
    "\n",
    "predict(x[0], rand_cent(4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 2.80293085 -2.7315146 ]\n",
      " [-2.46154315  2.78737555]\n",
      " [-3.38237045 -2.9473363 ]\n",
      " [ 2.6265299   3.10868015]]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG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spNWSLpP0bjO7rNhRZWpC0oi7v1HSVZI+VPLXK0m3Snqq6EF0g0CerbskfVRS6WeU3f2b7j5x5q+PSrq4yPFk4EpJz7j7D9z9lKQvSbqx4DFlxt1fdPfvnfn/E2oEuNIuRm9mF0u6TtLdRY+lGwTyjJjZDZLG3P1Q0WMpwPsl7Sl6ECkbkvTjaX9/XiUObNOZ2TJJKyR9t9iRZOpf1Ei6Thc9kG5wh6AemNm3JL2uxY/ukPQxSX+a74iyNdfrdfeHzjzmDjVOy+/Nc2w5sBbbSn+mZWaLJT0g6TZ3/2XR48mCmV0v6afufsDM/qTo8XSDQN4Dd7+m1XYzu1zSJZIOmZnUKDN8z8yudPef5DjEVLV7vVPM7H2Srpf0Ni/fBQrPS1oy7e8XS3qhoLHkwsxqagTxe919V9HjydBKSTeY2TsknSfpAjPb6e7rCh5XYlwQlAMz+5GkYXcPeVW1npjZtZI+I+mP3f1Y0eNJm5mdo8Yk7tskjUl6TNJfuPvhQgeWEWtkIF+U9HN3v63o8eTlTEb+EXe/vuixdIIaOdKyXdJrJD1sZo+b2b8VPaA0nZnI/bCkvWpM/H2lrEH8jJWS1ku6+sz7+fiZjBUBIiMHgMiRkQNA5AjkABA5AjkARI5ADgCRI5ADQOQI5AAQOQI5AETu/wFPPe9GDuRZ0QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def get_cents(k):\n",
    "\n",
    "    #随机初始化k个中心点\n",
    "    cents = rand_cent(k)\n",
    "\n",
    "    #循环训练\n",
    "    pred = np.zeros(N)\n",
    "    changed = True\n",
    "    while changed:\n",
    "        changed = False\n",
    "\n",
    "        #把每个点都归类到某种中心点\n",
    "        for i in range(N):\n",
    "            ki,d = predict(x[i],cents)\n",
    "\n",
    "            if pred[i] != ki:\n",
    "                changed = True\n",
    "            pred[i] = ki\n",
    "\n",
    "        #重新计算中心点的位置,为属于自己的点的均值\n",
    "        for ki in range(k):\n",
    "            x_ki = x[pred == ki]\n",
    "            cents[ki] = np.mean(x_ki, axis=0)\n",
    "    return cents\n",
    "\n",
    "\n",
    "cents = get_cents(4)\n",
    "print(cents)\n",
    "\n",
    "draw(cents)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3dd3hUVfrA8e+ZPukJCb2KgCAoAqIuIoIN7Kv8FBDXjmtvu/bVtW6x4K5Y1y66FnDtCKjY6dKkgxA6BEhIm3rv+f0xGAiZQEhm5s4k7+d5eDR37tz7TiBvzj3lPUprjRBCiNRlszoAIYQQDSOJXAghUpwkciGESHGSyIUQIsVJIhdCiBTnsOKm+fn5umPHjlbcWgghUtbcuXO3a60L9j1uSSLv2LEjc+bMseLWQgiRspRShdGOS9eKEEKkOEnkQgiR4iSRCyFEipNELoQQKU4SuRACAG2WoYOz0eGo42kiiVkya0UIkVzM8meg/HlQTtBhtLMHKvc5lC3X6tBiSusAmLvA1gyl7FaHEzPSIheiidP+yVD+IhAAXQ74IbQQXXKz1aHFjNYhzNKH0Fv7oYtOQm87DrNyotVhxYwkciGaOF3xCuDb52gYgnPRxjYrQoo5XfooVL4PBCJ/dAmUPoD2T7M6tJiQRC5EU2fujH5cOUCXJjaWONDaB74JgH+fV/zoinFWhBRzksiFaOrcJxB9uMwB9g6Jjib2zBJARX/N2JzQUOJFErkQTZxK/yPYsgHXb0cAD2Teh1JOCyOLEVsBKFeUFxQ4eiU8nHiQRC5EE6fsBaj8zyD9CnAcAe5TUXlvYEs72+rQYkI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1W2CTRbEkhFLKSSSJv6W1/sDqeOJoAHC2Uup0wANkKaXGa61HWxxXncmCoARQSq0F+mmtk7mqWoMopYYCTwKDtNZFVscTa0opB5FB3JOAjcBsYJTWerGlgcWJirRAXgd2aq1vtjqeRNndIv+T1vpMq2M5GNJHLmJlHJAJTFVKzVdKPW91QLG0eyD3emAykYG/9xprEt9tAHAxMGT33+f83S1WkYSkRS6EEClOWuRCCJHiJJELIUSKk0QuhBApThK5EEKkOEnkQgiR4iSRCyFEipNELoQQKe7/AUOszPuXhiKSAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#画图\n",
    "y = np.empty(N)\n",
    "for i in range(N):\n",
    "    y[i], _ = predict(x[i], cents)\n",
    "draw(cents, y)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
